package action;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import biz.CartBiz;

import dao.ItemDAO;

import util.ActionForward;
import vo.Cart;
import vo.Item;

public class ItemCartListAction implements Action{

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
	
		CartBiz cartBiz = new CartBiz();
		ArrayList<Cart> cartList=cartBiz.getCartList(request);
		int sumMoney = 0;
		for(int i=0; i<cartList.size(); i++){
			int money = cartList.get(i).getPrice()*cartList.get(i).getQuantity();
			sumMoney += money;
		}
		request.setAttribute("sumMoney", sumMoney);
		request.setAttribute("cartList", cartList);
		
		ActionForward forward = new ActionForward();
		forward.setUrl("itemCartList.jsp");
		return forward;
	}

}
